<html>
<head><meta charset="utf-8"><title>Generalized measureme-like library · t-compiler/performance · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/index.html">t-compiler/performance</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html">Generalized measureme-like library</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="207464721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207464721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207464721">(Aug 19 2020 at 21:40)</a>:</h4>
<p>Good afternoon, a couple of days ago i found out about rustc's self profiling capabilities and measureme. I loved the concept from the start, being able to easily profile parts of code or your entire application very easily is something i wanted in my project and thought it would be very useful in general. However, looking deeper into it i realized measureme is just way too specific to rustc to be able to be easily adapted without making a wrapper on top of it. My main concerns boiled down to:</p>
<h1>Profiling sub parts of an application</h1>
<p>This is kind of just ugly, lets say i want to profile a small bit of code, well that means i must either lump the event with the rest of my program, or i need to make a new profiler, which well, its going to make 3 more files, here comes the clutter.</p>
<h1>Automatic persistance to file is very very annoying</h1>
<p>My biggest concern, no easy in-memory event data, this is pretty much the deal breaker for me, i would love to have control on what i do with my event data, do i want to just run a table generator to easily view the slowest traces? do i want to then output a flamegraph? all of this should be extremely easy for me to do on an EventData struct. i could simply have:</p>
<div class="codehilite"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">profile_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">my_app</span><span class="p">.</span><span class="n">profiler</span><span class="p">.</span><span class="n">data</span><span class="p">();</span><span class="w"></span>

<span class="c1">// display 20 slowest traces</span>
<span class="c1">// We can also offer both ASCII and (prettier) unicode tables</span>
<span class="kd">let</span><span class="w"> </span><span class="n">summarize_opts</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">SummarizeOptions</span>::<span class="n">default</span><span class="p">().</span><span class="n">max_count</span><span class="p">(</span><span class="mi">20</span><span class="p">).</span><span class="n">chars</span><span class="p">(</span><span class="n">Chars</span>::<span class="n">Unicode</span><span class="p">);</span><span class="w"></span>

<span class="c1">// Having a print function would allow us to use termcolor to style this nicely and still have it be portable</span>
<span class="c1">// Otherwise we can simply impl Display for this and have it render using uncolored text</span>
<span class="n">profile_data</span><span class="p">.</span><span class="n">summarize</span><span class="p">(</span><span class="n">summarize_opts</span><span class="p">).</span><span class="n">print</span><span class="p">()</span><span class="o">?</span><span class="p">;</span><span class="w"></span>

<span class="c1">// Make a flamegraph from the data and persist it to file, this should take a `Write` to allow for buffers but thats a separate thing</span>
<span class="n">profile_data</span><span class="p">.</span><span class="n">flamegraph</span><span class="p">(</span><span class="s">&quot;my_flamegraph.svg&quot;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>

<span class="c1">// Persist the data to disk in the form of 3 files, same as measureme does right now automatically.</span>
<span class="n">profile_data</span><span class="p">.</span><span class="n">persist</span><span class="p">(</span><span class="s">&quot;./my_trace/&quot;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
</code></pre></div>


<p>lets say i want to get something specific from my profiler which has some nice data because it has already run on something. That would be very trivial.</p>
<div class="codehilite"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">profile_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">my_app</span><span class="p">.</span><span class="n">profiler</span><span class="p">.</span><span class="n">data</span><span class="p">();</span><span class="w"></span>

<span class="kd">let</span><span class="w"> </span><span class="n">duration</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">profile_data</span><span class="p">.</span><span class="n">get_trace_data</span><span class="p">(</span><span class="s">&quot;parsing&quot;</span><span class="p">).</span><span class="n">expect</span><span class="p">(</span><span class="s">&quot;Parsing has not been traced yet!&quot;</span><span class="p">);</span><span class="w"></span>

<span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Parsing took {}ms&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">duration</span><span class="p">.</span><span class="n">as_millis</span><span class="p">());</span><span class="w"></span>
</code></pre></div>


<p>This would expand the scope of what you can do with the data massively, want to read existing data? very trivial:</p>
<div class="codehilite"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">profile_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ProfileData</span>::<span class="n">from_files</span><span class="p">(</span><span class="s">&quot;./my_trace/&quot;</span><span class="p">).</span><span class="n">expect</span><span class="p">(</span><span class="s">&quot;Invalid or missing data&quot;</span><span class="p">);</span><span class="w"></span>

<span class="c1">// We can also build dot graphs out of the data to allow for easier visualization of the flow of the program</span>
<span class="c1">// We can also include the time it took in each node and color them heatmap-like based on the % of the time they took</span>
<span class="c1">// basically an alternative to flamegraphs</span>
<span class="kd">let</span><span class="w"> </span><span class="n">dot_config</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">DotConfig</span>::<span class="n">default</span><span class="p">().</span><span class="n">heatmap</span><span class="p">();</span><span class="w"></span>

<span class="n">profile_data</span><span class="p">.</span><span class="n">dot</span><span class="p">(</span><span class="n">dot_config</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;dot_data.dot&quot;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
</code></pre></div>


<p>Want to look at the difference between two runs? very trivial too:</p>
<div class="codehilite"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">first_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ProfileData</span>::<span class="n">from_files</span><span class="p">(</span><span class="s">&quot;./my_trace/&quot;</span><span class="p">).</span><span class="n">expect</span><span class="p">(</span><span class="s">&quot;Invalid or missing data&quot;</span><span class="p">);</span><span class="w"></span>
<span class="kd">let</span><span class="w"> </span><span class="n">second_data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">my_app</span><span class="p">.</span><span class="n">profiler</span><span class="p">.</span><span class="n">data</span><span class="p">();</span><span class="w"></span>

<span class="kd">let</span><span class="w"> </span><span class="n">diff</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">DiffData</span>::<span class="n">new</span><span class="p">(</span><span class="n">first_data</span><span class="p">,</span><span class="w"> </span><span class="n">second_data</span><span class="p">);</span><span class="w"></span>

<span class="n">diff</span><span class="p">.</span><span class="n">flamegraph</span><span class="p">(</span><span class="s">&quot;my_diff_flamegraph.svg&quot;</span><span class="p">)</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
</code></pre></div>


<p>This also works on Dot, and Summarize built in backends.</p>
<h1>Analysis on existing data is painful if you do not want to run multiple analyses</h1>
<p>Analysis tools being separate crates creates an ugly interface, what if i just want to get a flamegraph for this specific session? well, i need to first profile, then run a separate tool to convert it to the thing i actually want, then i need to clean up the profiling data.</p>
<p>I understand why that is the case, sometimes you want to run multiple analyses, but automatically persisting to file leaves no room for easy output of individual analyzers. Analysis tools should be built in to the crate to allow for cleaner and more streamlined ways of analyzing that data.</p>
<h1>Macros save the day</h1>
<p>Macros would make using the library so much easier, being able to easily trace a function with a proc macro would make things very easy to use. The macros would work on a global profiler (a OnceCelled Profiler). This profiler can be enabled or disabled to pause tracing at any time. Proc macros may be used to profile with a different profiler but i have not thought about the best way of doing this yet, maybe an argument to the macro?</p>
<div class="codehilite"><pre><span></span><code><span class="c1">// No argument, the event recorded is the name of the function</span>
<span class="cp">#[trace]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">parse_expr</span><span class="p">(</span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">Parser</span><span class="p">)</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="c1">// The event recorded has the name fed in, the label and event ids are the same</span>
<span class="cp">#[trace(</span><span class="s">&quot;Woohoo parse all the things🦀&quot;</span><span class="cp">)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">something_else</span><span class="p">(</span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">Parser</span><span class="p">)</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="c1">// The event recorded has the category of parsing and the name of the second argument</span>
<span class="cp">#[trace(</span><span class="s">&quot;Parsing&quot;</span><span class="cp">, </span><span class="s">&quot;🦀consume tokens 🦀&quot;</span><span class="cp">)]</span><span class="w"></span>
<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">consume</span><span class="p">(</span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">Parser</span><span class="p">)</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">a</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">trace_block</span><span class="o">!</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s">&quot;one chunky statement&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">       </span><span class="n">do_something</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>My proposal is to either:</p>
<ul>
<li>Refactor measureme into a more general, non-rustc specific library, it has a lot of potential and i genuinely think it is a great concept.</li>
<li>Make a new library based on these concepts and eventually, if wanted, phase out measureme and use that library instead.</li>
</ul>
<p>Just some thoughts i had on this kind of thing, lemme know what you guys think and any criticisms of this design <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207465411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207465411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207465411">(Aug 19 2020 at 21:48)</a>:</h4>
<p>I believe that the backends used to write data are already well-factored out inside measureme, and if you wanted to add an in-memory backend we would not oppose that.</p>
<p>Trace macros like you suggest are done (well, I suspect, though have not used) by tracing and that family of crates. I am personally not sure that they would help much in rustc's case, but I could be wrong. Integration of measureme and tracing via the subscriber functionality has been experimented with, in <a href="https://github.com/rust-lang/measureme/pull/120">https://github.com/rust-lang/measureme/pull/120</a>, but at least at rustc's scale doesn't quite make sense as being in the same framework. I don't think rustc annotates enough functions to make it worthwhile to do as you suggest and add macros, because macros do have a readability/understanding cost. Of course, a proc macro should be able to call measureme's APIs if desired without measureme knowing anything about it.</p>



<a name="207465679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207465679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207465679">(Aug 19 2020 at 21:51)</a>:</h4>
<p>I do realize at rustc's level it is just queries and those are profiled automatically (as far as i know), however rustc does not have to use the macros. They would mostly be something out of the scope of rustc, considering rustc already has a SelfProfiler, so it really makes no sense to use a global profiler and try to refactor it to use that.</p>



<a name="207465815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207465815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207465815">(Aug 19 2020 at 21:53)</a>:</h4>
<p>Tracing does something kind of different, measureme is more about just knowing how long each thing took and how it compares to other runs. While tracing is about well, tracing the execution of a program, where you have data that can be tacked on to each event and it displays it nicely.</p>



<a name="207466250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207466250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207466250">(Aug 19 2020 at 21:58)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span>, thanks for the feedback! I'll try to respond to most of your points but apologies if I miss something. </p>
<blockquote>
<p>Profiling sub parts of an application</p>
</blockquote>
<p>I'm not quite following what the issue is. Could you expand on this a bit? </p>
<blockquote>
<p>Automatic persistance to file is very very annoying</p>
</blockquote>
<p>You can capture only in memory right now with the appropriate sink (for a basic example: <a href="https://docs.rs/measureme/0.7.1/measureme/struct.ByteVecSink.html">https://docs.rs/measureme/0.7.1/measureme/struct.ByteVecSink.html</a>). This could probably be improved pretty easily to make this more ergonomic/performant. I would be happy to see improvements there.</p>
<blockquote>
<p>Analysis tools being separate crates creates an ugly interface, what if i just want to get a flamegraph for this specific session? </p>
</blockquote>
<p>With the in memory sink above, your app can call into those crates without going through the disk. Or least, we could certainly make that work however, it's unlikely we would move all of that code into the <code>measureme</code> crate directly since that's what rustc depends on and it wouldn't make use of that.</p>
<blockquote>
<p>Macros save the day</p>
</blockquote>
<p>I would not be opposed to having better ergonomics for profiling functions or sections of code but how your program integrates with <code>measureme</code> can vary so it would likely complicate the macros like you mention. </p>
<blockquote>
<p>Refactor measureme into a more general, non-rustc specific library, it has a lot of potential and i genuinely think it is a great concept.<br>
   Make a new library based on these concepts and eventually, if wanted, phase out measureme and use that library instead.</p>
</blockquote>
<p>I think there's merit to both of these approaches however, rustc really really really cares about low overhead recording for millions to billions of events. I would be happy to land changes that make <code>measureme</code> easier to consume from other applications (FYI, the boa JS engine recently integrated <code>measureme</code> into their project and found a number of performance improvements) but we can't hurt rustc's use case in the process.</p>



<a name="207467259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207467259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207467259">(Aug 19 2020 at 22:09)</a>:</h4>
<p>Thank you for the feedback!</p>
<blockquote>
<p>I'm not quite following what the issue is. Could you expand on this a bit?</p>
</blockquote>
<p>Right now measureme does not quite work ergonomically with multiple profilers, because well, each profiler dumps a good amount of data. 3 files being dumped with every profiler means you will run into clutter if you want to just have individual, isolated profilers for specific things.</p>
<blockquote>
<p>You can capture only in memory right now with the appropriate sink</p>
</blockquote>
<p>I looked at that, but the other big big part of my concerns was that the data is just so so so ugly to work with, you are essentially working over bytes of data, my proposal instead is:</p>
<ul>
<li>One single data struct</li>
<li>the data struct has a persist method, this chooses whether to use the mmap or file backend (to my understanding, mmap sink is faster on non windows, correct?) automatically, the user doesnt need to know about this abstraction</li>
<li>The data struct is kind of the heart of measureme, all the good stuff is here, it would have methods to get traces out of it, to maybe modify a trace, delete a trace, etc.</li>
</ul>
<blockquote>
<p>... that's what rustc depends on and it wouldn't make use of that.</p>
</blockquote>
<p>methods such as <code>.flamegraph()</code> and <code>.dot()</code> would be feature locked ("analysis" maybe?), since i understand many uses may not need the analysis tools, they just want to use the data. a serialization feature would also be added to allow people to serialize the data into json for whatever they need.</p>
<blockquote>
<p>... but how your program integrates with measureme can vary so it would likely complicate the macros like you mention.</p>
</blockquote>
<p>I understand that, which is why the macros would be utilities for a "const" profiler (a profiler in a OnceCell), most people do not need many profilers, for them starting a single profiler at the start of the program is enough. Which is why that approach would help most people.</p>
<blockquote>
<p>... we can't hurt rustc's use case in the process.</p>
</blockquote>
<p>I understand that, making a data struct would not add a lot, if any, overhead to the existing implementation. Especially since a lot of this would be feature locked. I am not sure if a OnceCell dependency would be acceptable, if not, then that can be behind a feature too, its not too big of an issue id say.</p>



<a name="207468695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207468695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207468695">(Aug 19 2020 at 22:26)</a>:</h4>
<blockquote>
<p>Right now measureme does not quite work ergonomically with multiple profilers</p>
</blockquote>
<p>Ah, ok yes I totally agree. In general, we haven't thought through/don't have a good story around multiple profilers or capturing multiple crates into a single profile. (For example, you use a dependency which can export <code>measureme</code> events, how do you get that to talk to your profiler?)</p>
<blockquote>
<p>I looked at that, but the other big big part of my concerns was that the data is just so so so ugly to work with, you are essentially working over bytes of data</p>
</blockquote>
<p>In what sense? Consumers should either be using <code>Profiler::record_instant_event</code> or <code>Profiler::start_recording_interval_event</code> to generate data and then <code>analyzeme::ProfilingData</code> to read the data back. There shouldn't need to be any messing with raw bytes. </p>
<blockquote>
<p>One single data struct<br>
et al</p>
</blockquote>
<p>This generally seems fine to me in that we have this struct already <code>Profiler</code>. We could certainly add a convenience function to use the "best" serialization sink we ship with for your platform. The other functions seem probably fine as long as we can do them without storing all the events in memory if you're using a file sink. </p>
<blockquote>
<p>methods such as .flamegraph() and .dot() would be feature locked ("analysis" maybe?)</p>
</blockquote>
<p>Are you thinking these would return strings (for example) or a richer data type? This seems fine in principle since they're feature flagged off. </p>
<blockquote>
<p>a serialization feature would also be added to allow people to serialize the data into json for whatever they need.</p>
</blockquote>
<p>I don't see a huge need for that since that's essentially what the current file sinks give you but in a much more efficient format. I'm not strongly opposed though provided it's understood the json schema is not stable. </p>
<blockquote>
<p>I am not sure if a OnceCell dependency would be acceptable, if not, then that can be behind a feature too, its not too big of an issue id say.</p>
</blockquote>
<p>It's probably acceptable to take a dependency on OnceCell but, as you say, we can also feature flag that off.</p>



<a name="207468846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207468846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207468846">(Aug 19 2020 at 22:28)</a>:</h4>
<p><code>OnceCell</code> is now in std too, if you're allowed unstable features</p>



<a name="207468874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207468874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207468874">(Aug 19 2020 at 22:28)</a>:</h4>
<p>isn't most of the point of the library being as cheap as possible?</p>



<a name="207468888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207468888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207468888">(Aug 19 2020 at 22:29)</a>:</h4>
<p>Oh, perfect! Yeah we can use unstable features if there's a good motivation.</p>



<a name="207468898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207468898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207468898">(Aug 19 2020 at 22:29)</a>:</h4>
<p>otherwise you probably can just use tracing's timestamps?</p>



<a name="207469010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469010">(Aug 19 2020 at 22:30)</a>:</h4>
<p>to sound less flippant: most of the complexity in <code>measureme</code> seems to be in trying to be <em>extremely</em> efficient, including have a whole string (rope?) management scheme that you would just not need if you were outputting JSON</p>



<a name="207469026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469026">(Aug 19 2020 at 22:31)</a>:</h4>
<p>maybe the analaysis side could be shared? like I could see taking a stream of events and figuring out the nesting?</p>



<a name="207469110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469110">(Aug 19 2020 at 22:32)</a>:</h4>
<p>but you can probably just do whatever you want for collecting them if you don't need the low-overhead</p>



<a name="207469180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469180">(Aug 19 2020 at 22:33)</a>:</h4>
<blockquote>
<p>Are you thinking these would return strings (for example) or a richer data type? This seems fine in principle since they're feature flagged off.</p>
</blockquote>
<p>Dot and Flamegraph would take a generic <code>Write</code> to allow people more control over where they want the final data to go. Summarize would output a string which can be easily printed.</p>



<a name="207469292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469292">(Aug 19 2020 at 22:34)</a>:</h4>
<p>Colored output with termcolor would be nice, since it would be feature locked i guess that would be acceptable?</p>



<a name="207469344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469344">(Aug 19 2020 at 22:35)</a>:</h4>
<p>summarize could output a printable data type that can also be serialized to JSON (like <code>summarize summarize --json</code>, which I've used extensibly)</p>



<a name="207469353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469353">(Aug 19 2020 at 22:35)</a>:</h4>
<p>Yes, the main goal is to be very low-overhead. That's why events are persisted to disk and all of the analysis is done offline. I'd love to make things easier to use provided we don't hurt the performance.</p>



<a name="207469379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469379">(Aug 19 2020 at 22:35)</a>:</h4>
<p>there isn't much of an ergonomic problem in Rust to have a type that implements <code>fmt::Display</code> and you can just call <code>.to_string()</code> on it</p>



<a name="207469406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469406">(Aug 19 2020 at 22:35)</a>:</h4>
<p>I kind of like that, but summarize only outputs X longest traces, maybe we could have an option to output all?</p>



<a name="207469456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469456">(Aug 19 2020 at 22:36)</a>:</h4>
<p>that's not what it does though?</p>



<a name="207469462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469462">(Aug 19 2020 at 22:36)</a>:</h4>
<p>it outputs sums, not top N</p>



<a name="207469465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469465">(Aug 19 2020 at 22:36)</a>:</h4>
<p>Is that not right? thats what i saw when i looked at it</p>



<a name="207469480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469480">(Aug 19 2020 at 22:36)</a>:</h4>
<p>and people usually truncate it but the output itself is 200+ rows long or however many queries rustc has</p>



<a name="207469489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469489">(Aug 19 2020 at 22:36)</a>:</h4>
<p>yes i meant the top X summed traces with the same id</p>



<a name="207469503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469503">(Aug 19 2020 at 22:37)</a>:</h4>
<p>It sounds like a lot of this could be built in a separate library on top of <code>measureme</code> and then uplifted into measureme if there isn't adverse affects on performance.</p>



<a name="207469529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469529">(Aug 19 2020 at 22:37)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> most annoying thing to me for a long while was the split into 3 files, which I think is unnecessary for performance but I should prove it :P (especially now that we have better ways to quantify the overhead)</p>



<a name="207469559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469559">(Aug 19 2020 at 22:38)</a>:</h4>
<p>Maybe separate crate and feature locked methods on the data struct?</p>



<a name="207469597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469597">(Aug 19 2020 at 22:38)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> I'm still not sure what you mean</p>



<a name="207469618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469618">(Aug 19 2020 at 22:38)</a>:</h4>
<p>if you add together all the "self time"s you should get the exact total</p>



<a name="207469619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469619">(Aug 19 2020 at 22:38)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  I've got an idea bouncing around my head to get it down to 1 file I believe.</p>



<a name="207469626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469626">(Aug 19 2020 at 22:38)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> I think i misunderstood what summarize did, i think i get it now <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207469655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469655">(Aug 19 2020 at 22:38)</a>:</h4>
<p>alright, glad that's resolved, I'll leave before this headache makes it even harder to talk lol</p>



<a name="207469672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469672">(Aug 19 2020 at 22:39)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> I mean I would just put string building into events and have the reader side take the hit of having to build the string table, but maybe that's naive</p>



<a name="207469761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469761">(Aug 19 2020 at 22:40)</a>:</h4>
<p>(note that I would only do this if it would not slow down recording regular events <em>at all</em>)</p>



<a name="207469863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207469863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207469863">(Aug 19 2020 at 22:41)</a>:</h4>
<p>Maybe It could be done like:</p>
<ul>
<li>Flamegraph, crox, stack collapse, and summarize are combined into one with analyzeme</li>
<li>Refactor measureme data into a struct, that struct then has feature locked methods which just call analyzeme, methods like <code>.flamegraph()</code>, etc</li>
<li>Analyzeme has further methods for getting diffs of existing files, etc</li>
</ul>



<a name="207470001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470001">(Aug 19 2020 at 22:43)</a>:</h4>
<p>actually, something that's a bit odd but: why doesn't <code>measureme</code> use "multiple binaries per Cargo package"?</p>



<a name="207470009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470009">(Aug 19 2020 at 22:43)</a>:</h4>
<p>or <code>analyzeme</code> I guess</p>



<a name="207470016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470016">(Aug 19 2020 at 22:43)</a>:</h4>
<p>the binaries could be CLI wrappers around a library</p>



<a name="207470025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470025">(Aug 19 2020 at 22:43)</a>:</h4>
<p>That way you have the best of both worlds, no more overhead (maybe persisting to file once instead of after each recording would be some overhead?) but you still have the ability to make nice graphs very easily</p>



<a name="207470079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470079">(Aug 19 2020 at 22:44)</a>:</h4>
<p>Mostly that I didn't know what I was doing when I set up the workspace <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207470087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470087">(Aug 19 2020 at 22:44)</a>:</h4>
<p>ah heh</p>



<a name="207470114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470114">(Aug 19 2020 at 22:44)</a>:</h4>
<p>I think the problem is workspaces are new and some people learned about them and didn't know Cargo wasn't completely unusable before :P</p>



<a name="207470168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470168">(Aug 19 2020 at 22:45)</a>:</h4>
<p>Im not sure if the macros and static profiler are acceptable without a feature, but that would be in measureme too</p>



<a name="207470173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470173">(Aug 19 2020 at 22:45)</a>:</h4>
<p>like I keep seeing people surprised by "multiple crates into one package" and while it technically makes sense, maybe it could've been designed/communicated better</p>



<a name="207470252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470252">(Aug 19 2020 at 22:46)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> what I'd say is you should use <code>measureme</code> only if you need the low overhead and otherwise directly record data in the <code>analyzeme</code> format</p>



<a name="207470258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470258">(Aug 19 2020 at 22:46)</a>:</h4>
<p>(in memory or JSON or w/e)</p>



<a name="207470284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470284">(Aug 19 2020 at 22:47)</a>:</h4>
<p>I think part of the reason it didn't occur to me was that we wanted analyzeme to be a separate crate in the workspace so once I'd figured that part out, the "everything looks like a nail when all you have is a hammer" syndrome kicked in.</p>



<a name="207470298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470298">(Aug 19 2020 at 22:47)</a>:</h4>
<p>Maybe the other way where analyzeme relies on measureme for getting the actual data? im not sure</p>



<a name="207470337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470337">(Aug 19 2020 at 22:47)</a>:</h4>
<p>like if you need the <code>analyzeme</code> functionality without the profile recording, you could just skip all of that complexity entirely</p>



<a name="207470408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470408">(Aug 19 2020 at 22:48)</a>:</h4>
<p>there's no need for everything built around the binary format and the string tables etc.</p>



<a name="207470438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470438">(Aug 19 2020 at 22:49)</a>:</h4>
<p>So analyzeme would have its own profiler which gives different data?</p>



<a name="207470462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470462">(Aug 19 2020 at 22:49)</a>:</h4>
<p>like the <code>Profiler</code> in <code>measureme</code> isn't really a "profiler" as much as it is a binary serializer of profile events</p>



<a name="207470486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470486">(Aug 19 2020 at 22:49)</a>:</h4>
<p>the high-level data structures don't exist on the recording side right now, only on the analysis side</p>



<a name="207470491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470491">(Aug 19 2020 at 22:49)</a>:</h4>
<p>yeah thats true, analyzeme having its own more high level profiler would be nice</p>



<a name="207470532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470532">(Aug 19 2020 at 22:50)</a>:</h4>
<p>Well, I think eddyb's point is that if you're willing to accept the overhead of storing this stuff in memory and doing the analysis online, then a lot of the complexity that exists in measureme today is unnecessary.</p>



<a name="207470545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470545">(Aug 19 2020 at 22:50)</a>:</h4>
<p>thats true</p>



<a name="207470550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470550">(Aug 19 2020 at 22:50)</a>:</h4>
<p><code>rustc_data_structures</code> has a type that is far more like what one might consider a profiler</p>



<a name="207470560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470560">(Aug 19 2020 at 22:50)</a>:</h4>
<p>which wraps the <code>Profiler</code> from <code>measureme</code> and emits events into it</p>



<a name="207470591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470591">(Aug 19 2020 at 22:50)</a>:</h4>
<p>so we could shift the perspective a bit around and have the <code>measureme</code> have a <code>LowOverheadRecorder</code></p>



<a name="207470616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470616">(Aug 19 2020 at 22:51)</a>:</h4>
<p>yeah so measureme would be the low level high performance (yet limited) profiler</p>



<a name="207470623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470623">(Aug 19 2020 at 22:51)</a>:</h4>
<p>and you could have a type that can wrap a "recorder"</p>



<a name="207470640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470640">(Aug 19 2020 at 22:51)</a>:</h4>
<p>similar to how the <code>measureme</code> type today wraps a "(byte) sink"</p>



<a name="207470687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470687">(Aug 19 2020 at 22:52)</a>:</h4>
<p>and doesn't care how the bytes are written</p>



<a name="207470698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470698">(Aug 19 2020 at 22:52)</a>:</h4>
<p>just levels of abstraction</p>



<a name="207470702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470702">(Aug 19 2020 at 22:52)</a>:</h4>
<p>that's only if you need a common API at all</p>



<a name="207470761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470761">(Aug 19 2020 at 22:53)</a>:</h4>
<p>but also I was imagining you could build you own profiling thing pretty easily by just pushing <code>(Instant::now(), Event::Foo)</code> into a <code>Vec</code></p>



<a name="207470772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470772">(Aug 19 2020 at 22:53)</a>:</h4>
<p>or hook it up to <code>tracing</code> events</p>



<a name="207470799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470799">(Aug 19 2020 at 22:53)</a>:</h4>
<p>and I'd start by making a small demo like that, using the data types from <code>analyzeme</code> and then see if there is any point in abstracting it</p>



<a name="207470902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470902">(Aug 19 2020 at 22:55)</a>:</h4>
<p>having spent the past few weeks of my life deep inside <code>measureme</code>, most of the code to me looks like a Rube Goldberg machine to encode timestamps into bytes :P</p>



<a name="207470914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470914">(Aug 19 2020 at 22:55)</a>:</h4>
<p><span aria-label="grimacing" class="emoji emoji-1f62c" role="img" title="grimacing">:grimacing:</span></p>



<a name="207470916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470916">(Aug 19 2020 at 22:55)</a>:</h4>
<p>Haha thats true</p>



<a name="207470976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470976">(Aug 19 2020 at 22:56)</a>:</h4>
<p>dont forget about the string table <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="207470994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207470994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207470994">(Aug 19 2020 at 22:56)</a>:</h4>
<p>(not in a bad way, I just have mentally abstracted away anything that's outside "time since start of profiling" which is what I have been modifying)</p>



<a name="207471008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471008">(Aug 19 2020 at 22:56)</a>:</h4>
<p>yeah, sorry, pairs of timestamps and (optimized) strings</p>



<a name="207471046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471046">(Aug 19 2020 at 22:56)</a>:</h4>
<p>If not for the string table, traces from rustc would be multi-gigabyte probably. <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207471064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471064">(Aug 19 2020 at 22:57)</a>:</h4>
<p>the virtual stuff is a really clever solution too</p>



<a name="207471073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471073">(Aug 19 2020 at 22:57)</a>:</h4>
<p>I would've done something less elegant lol</p>



<a name="207471078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471078">(Aug 19 2020 at 22:57)</a>:</h4>
<p>Interning saves the day</p>



<a name="207471091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471091">(Aug 19 2020 at 22:57)</a>:</h4>
<p>interning and ropes and lazy binding :P</p>



<a name="207471157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471157">(Aug 19 2020 at 22:58)</a>:</h4>
<p>The string table still confuses the heck out of me, im not sure whats going on there</p>



<a name="207471161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471161">(Aug 19 2020 at 22:58)</a>:</h4>
<p>anyway like I said, I'll go before I get even less coherent, maybe if I forget all the Intel codenames the headache will go away</p>



<a name="207471186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471186">(Aug 19 2020 at 22:58)</a>:</h4>
<p><span class="user-mention" data-user-id="276242">@Riccardo D'Ambrosio</span> instead of storing strings, store instructions to build strings on the decoder side</p>



<a name="207471209"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471209" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471209">(Aug 19 2020 at 22:59)</a>:</h4>
<p>defer cost at any cost</p>



<a name="207471233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471233">(Aug 19 2020 at 22:59)</a>:</h4>
<p>That should probably be the project moto lol</p>



<a name="207471245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471245">(Aug 19 2020 at 22:59)</a>:</h4>
<p>Hmmm, i think ive heard of ropes in terms of lexers, but im still not sure what they refer to haha</p>



<a name="207471351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471351">(Aug 19 2020 at 23:00)</a>:</h4>
<p>your string representation being <code>Vec&lt;String&gt;</code> or similar (probably linked lists). defer concatenation until needed (if ever)</p>



<a name="207471359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471359">(Aug 19 2020 at 23:00)</a>:</h4>
<p>JS engines love to do this</p>



<a name="207471372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471372">(Aug 19 2020 at 23:00)</a>:</h4>
<p>(and yes the name is just a pun lol)</p>



<a name="207471644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471644">(Aug 19 2020 at 23:03)</a>:</h4>
<p>I think i will experiment and make my own lib first for my project (js linter, speed matters), then maybe ill see how i could rework analyzeme in the future to work like that <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="207471864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471864">(Aug 19 2020 at 23:06)</a>:</h4>
<p>You might also want to look in to the tracing crate. From what I've heard (I have not used it), it sounds like they're building similar tools so you might find they already have what you need.</p>



<a name="207471924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471924">(Aug 19 2020 at 23:07)</a>:</h4>
<p>I looked at it, I could probably use it, but i dont need tracing, i just need profiling data like measureme, so i think its overkill for me</p>



<a name="207471932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207471932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207471932">(Aug 19 2020 at 23:07)</a>:</h4>
<p>Ah gotcha</p>



<a name="207472024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207472024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207472024">(Aug 19 2020 at 23:08)</a>:</h4>
<p>Well, it is great to get some feedback on measureme so thank you a lot for that! It's clear there are some probably easy wins to make the crate easier to use without affecting performance at all.</p>



<a name="207472040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207472040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207472040">(Aug 19 2020 at 23:08)</a>:</h4>
<p>Thank you for the feedback too</p>



<a name="207473131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207473131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207473131">(Aug 19 2020 at 23:23)</a>:</h4>
<p>the way measureme profiles is very _very_ similar to what tracing gives you more generically</p>



<a name="207473501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207473501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207473501">(Aug 19 2020 at 23:29)</a>:</h4>
<p>I would rather not include the whole of tracing when all i need is just basic profiling and graphing, i think the easiest way of doing this is actually to just make a new crate in my project lol</p>



<a name="207473514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207473514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Riccardo D&#x27;Ambrosio <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207473514">(Aug 19 2020 at 23:29)</a>:</h4>
<p>and as far as i know tracing doesnt have an easy way of say, making a flamegraph</p>



<a name="207473784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/247081-t-compiler/performance/topic/Generalized%20measureme-like%20library/near/207473784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/247081-t-compiler/performance/topic/Generalized.20measureme-like.20library.html#207473784">(Aug 19 2020 at 23:33)</a>:</h4>
<p><a href="http://docs.rs/tracing-flame">docs.rs/tracing-flame</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>